// Tags:
#include <algorithm>
#include <cstdio>

const int N = 1e2 + 5;
int n, a[N], b[N], a1, b1, a2, b2;

int exgcd(int a, int b, int &x, int &y) {
  if (!b) return x = 1, y = 0, a;
  int k = exgcd(b, a % b, y, x);
  y -= a / b * x;
  return k;
}

inline void solve(int x1, int y1, int &x2, int &y2, int &y) {
  if (!x1) y = y1;
  if (!x2) y = y2, x2 = x1, y2 = y1;
  else {
    int t1, t2;
    int d = exgcd(x1, x2, t1, t2);
    y = std::abs(x2 * y1 - x1 * y2) / d;
    int xx, yy, aa = x1 / d, bb = x2 / d;
    exgcd(aa, bb, xx, yy);
    y2 = y1 * xx + y2 * yy;
    x2 = d;
  }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3421 [POI2005]SKO-Knights.in", "r", stdin);
  freopen("P3421 [POI2005]SKO-Knights.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) { scanf("%d%d", &a[i], &b[i]); }
  int x, y;
  a1 = a[2], b1 = b[2];
  solve(a[1], b[1], a1, b1, b2);
  for (int i = 3; i <= n; ++i) {
    a2 = b2;
    solve(a[i], b[i], a1, b1, b2);
    b2 = exgcd(a2, b2, x, y);
  }
  for (int i = 3; i <= n; ++i) {
    a2 = b2;
    solve(a[i], b[i], a1, b1, b2);
    b2 = exgcd(a2, b2, x, y);
  }
  printf("%d %d\n0 %d", a1, b1, b2);
  return 0;
}